package com.piper.provider.provider;

import com.piper.intface.UserServiceInterface;
import com.piper.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author piper
 * @date 2019/1/14 22:54
 */
@Slf4j
@RestController
public class UserProvider implements UserServiceInterface {

    @Override
    public User test(String name) {
        int sleepTime = new Random().nextInt(1000);
        log.info("sleepTime: " + sleepTime);

        try {
            Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        User u = new User();
        u.setName(name);
        return u;
    }
}
